package org.nlp2rdf.navigator.client.common;

import java.util.ArrayList;
import java.util.List;

@SuppressWarnings("serial")
public class SearchResultDTO extends DTO {
	private List<ExampleDTO> matching = new ArrayList<ExampleDTO>();
	private List<ExampleDTO> notMatching = new ArrayList<ExampleDTO>();

	@Override
	public String toString() {
		String first = (getMatching().isEmpty()) ? "" : "\n" + getMatching().get(0).toString();

		return super.toString() + "matching: " + matching.size() + first;
	}

	public String toFullString() {
		StringBuffer buf = new StringBuffer();
		for (ExampleDTO ex : getMatching()) {
			buf.append(ex.toString() + "\n");
		}
		return buf.toString();
	}

	public void remove(List<ExampleDTO> toRemove) {
		remove(toRemove, matching);
		remove(toRemove, notMatching);
	}

	private void remove(List<ExampleDTO> toRemove, List<ExampleDTO> target) {
		for (ExampleDTO ex : toRemove) {
			target.remove(ex);
		}
	}

	public List<ExampleDTO> getMatching() {
		return matching;
	}

	public void setMatching(List<ExampleDTO> matching) {
		this.matching = matching;
	}

	public List<ExampleDTO> getNotMatching() {
		return notMatching;
	}

	public void setNotMatching(List<ExampleDTO> notMatching) {
		this.notMatching = notMatching;
	}
}
